package com.dst.service.impl;

import com.dst.dao.UserMapper;
import com.dst.eneity.User;
import com.dst.service.UserService;
import com.dst.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

public class UserServiceImpl implements UserService {
    @Override
    public User login(String username, String password) {
        User user=null;
        SqlSession sqlSession=null;
        try {
            sqlSession = MybatisUtils.getSqlSession();
            UserMapper mapper = sqlSession.getMapper(UserMapper.class);
            user = mapper.selectByNameAndPassword(username, password);
        } finally {
            sqlSession.close();
        }
        return user;
    }
}
